//package com.whyl.gongjiao.openapi.job;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.bootdo.wxpro.domain.KeyManagementDO;
//import JsonUtils;
//import com.whyl.gongjiao.openapi.util.StringCls;
//import com.whyl.gongjiao.provider.service.PubKeyApi;
//import RedisService;
//
//import org.apache.log4j.Logger;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
//@Component
//@Order(value = 1)
//public class KeyLoader implements CommandLineRunner {
//
//	private final static Logger log = Logger.getLogger(KeyLoader.class);
//
//	@Reference
//	private PubKeyApi pubKeyApi;
//
//	@Reference
//	private RedisService redisService;
//
//	@Override
//	public void run(String... arg0){
//		try {
//			List<KeyManagementDO> list = pubKeyApi.getAllActivateKey();
//			log.info("秘钥缓存个数："+list.size()+"   "+JsonUtils.toFastJson(list));
//			System.out.println("秘钥缓存个数："+list.size());
//			for(KeyManagementDO km : list){
//				if(km==null||StringCls.isEmpty(km.getPrivateKey())||StringCls.isEmpty(km.getPublicKey())||StringCls.isEmpty(km.getMacSecretKey())){
//					log.info(km.getAppletVersionNum()+"小程序RSAKey或MACKey为空！请检查数据库核实！KeyManagementDO_id="+km.getId());
//					continue;
//				}
//				log.info("Key_"+km.getAppletVersionNum()+"_"+km.getCityCode()+"缓存被更新！");
//				redisService.set("Key_"+km.getAppletVersionNum()+"_"+km.getCityCode(), km);
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//
//	}
//
//}